package com.controller.admin;

import com.controller.BaseController;
import com.entity.ShopOrder;
import com.github.pagehelper.PageInfo;
import com.service.imple.home.ShopOrderServiceImple;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 订单管理
 */

@Controller
@RequestMapping("admin/ShopOrder")
public class AdminShopOrderController extends BaseController<ShopOrderServiceImple> {

    @RequestMapping("toOrderManage")
    public String toOrderManage(){
        return "center/admin/order/OrderManage";
    }
    @RequestMapping("OrderManage")
    public String OrderManage(@RequestParam(value = "pageNum",required = false,defaultValue = "1") int pageNum,Integer id, ModelMap modelMap){
        Map<String,Object> map = new HashMap<>();
        map.put("pageNum",pageNum);
        map.put("id",id);
        PageInfo<ShopOrder> pageInfo = BaseService.selectByPage(map);
        modelMap.put("pageInfo",pageInfo);
        return "center/admin/order/OrderManagePage";
    }

    @RequestMapping("delete")
    public String delete(Integer id){
        BaseService.delete(id);
        return "center/admin/order/OrderManage";
    }

}
